package cn.yr.controller.manage;

import cn.yr.common.util.AjaxResult;
import cn.yr.domain.entity.Tag;
import cn.yr.service.portal.TagService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
* @Title: SysTagController
* @Description: 标签
* @author Lang
* @date 2020/3/22 14:34
*/
@RestController
@RequestMapping("/tag")
public class SysTagController {

	@Resource
	private TagService tagService;

	@GetMapping("/list")
	public AjaxResult list(){
		List<Tag> list = tagService.list();
		return AjaxResult.success(list);
	}
	@GetMapping("/listByName")
	public AjaxResult listByName(String tagName){
		QueryWrapper<Tag> tagQueryWrapper = new QueryWrapper<>();
		tagQueryWrapper.like("name", tagName);
		List<Tag> list = tagService.list(tagQueryWrapper);
		return AjaxResult.success(list);
	}
}
